<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
body {
	background: url(img/bg1.png);
	font-family: "黑体";
	font-size: 14px;
}

.login {
	background: url(img/back.png) -1px 0px; /*横向与纵向的偏移量*/
	height: 365px;
	width: 556px;
}

.divRow {
	height: 50px;
}

.text {
	width: 120px;
}

.submitClass {
	background: url(img/bt.png);
	width: 104px;
	height: 32px;
	border: none;
	cursor: pointer;
}
</style>
<script>
	function checkEmpty() {
		var sname = document.all.sname.value;
		var pswd = document.all.pswd.value;
		if(sname!="" && pswd!=""){
		alert(sname+","+pswd+",not null");
		return true;
		}
		return false;
	}
	function changeImg(img) {
		//浏览器里面有 src 的缓存，不会重新请求资源，路径拼接一个时间戳（毫秒值）
		var url = "<%=path%>+/code/img.jsp?date="+ new Date().getTime();
		alert(url);
		img.src = url;
	}

</script>
</head>

<body>
	<div>&nbsp;</div>
	<div>&nbsp;</div>
	<form action="LoginServlet?slever=<%=request.getParameter("slever") %>" method="post"
		onsubmit="return checkEmpty();">
		<table class="login" align="center" border="1">
			<tr>
				<td colspan="2"><div class="divRow">&nbsp;</div></td>
			</tr>
			<tr>
				<td width="40%" align="right">用户名:</td>
				<td width="60%"><input type="text" name="suser" class="text"
					value="zhangsan" /></td>
			</tr>
			<tr>
				<td align="right">密&nbsp;&nbsp;码:</td>
				<td><input type="password" name="spwd" class="text"
					value="123456" /></td>
			</tr>
			<tr>
				<td align="right">验证码:</td>
				<td><input type="text" name="code"><img alt="点击切换验证码"
					src="code/img.jsp" style="cursor: pointer;"
					onclick="changeImg(this);" ></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="submit" value=""
					class="submitClass" /><sub><a href="enroll.jsp">去注册</a></sub></td>
			</tr>

			<tr>
				<td colspan="2"><div class="divRow">&nbsp;</div></td>
			</tr>
		</table>
	</form>
</body>
</html>